#include <hxcpp.h>

#ifndef INCLUDED_Hash
#include <Hash.h>
#endif
#ifndef INCLUDED_JProperties
#include <JProperties.h>
#endif
#ifndef INCLUDED_StringTools
#include <StringTools.h>
#endif

Void JProperties_obj::__construct()
{
	return null();
}

JProperties_obj::~JProperties_obj() { }

Dynamic JProperties_obj::__CreateEmpty() { return  new JProperties_obj; }
hx::ObjectPtr< JProperties_obj > JProperties_obj::__new()
{  hx::ObjectPtr< JProperties_obj > result = new JProperties_obj();
	result->__construct();
	return result;}

Dynamic JProperties_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< JProperties_obj > result = new JProperties_obj();
	result->__construct();
	return result;}

::Hash JProperties_obj::read( ::String data){
	HX_SOURCE_PUSH("JProperties_obj::read")
	HX_SOURCE_POS("Source/JProperties.hx",9)
	::Hash hash = ::Hash_obj::__new();
	HX_SOURCE_POS("Source/JProperties.hx",10)
	Array< ::String > lines = data.split(HX_CSTRING("\n"));
	HX_SOURCE_POS("Source/JProperties.hx",11)
	{
		HX_SOURCE_POS("Source/JProperties.hx",11)
		int _g = (int)0;
		HX_SOURCE_POS("Source/JProperties.hx",11)
		while(((_g < lines->length))){
			HX_SOURCE_POS("Source/JProperties.hx",11)
			::String l = lines->__get(_g);
			HX_SOURCE_POS("Source/JProperties.hx",11)
			++(_g);
			HX_SOURCE_POS("Source/JProperties.hx",12)
			Array< ::String > li = l.split(HX_CSTRING(":"));
			HX_SOURCE_POS("Source/JProperties.hx",13)
			if (((li->length == (int)2))){
				HX_SOURCE_POS("Source/JProperties.hx",14)
				hash->set(::StringTools_obj::trim(li->__get((int)0)),::StringTools_obj::trim(li->__get((int)1)));
			}
		}
	}
	HX_SOURCE_POS("Source/JProperties.hx",16)
	return hash;
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(JProperties_obj,read,return )

::String JProperties_obj::write( ::Hash data){
	HX_SOURCE_PUSH("JProperties_obj::write")
	HX_SOURCE_POS("Source/JProperties.hx",19)
	::String s = HX_CSTRING("");
	HX_SOURCE_POS("Source/JProperties.hx",20)
	for(::cpp::FastIterator_obj< ::String > *__it = ::cpp::CreateFastIterator< ::String >(data->keys());  __it->hasNext(); ){
		::String k = __it->next();
		hx::AddEq(s,(((k + HX_CSTRING(": ")) + data->get(k)) + HX_CSTRING("\n")));
	}
	HX_SOURCE_POS("Source/JProperties.hx",23)
	return s;
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(JProperties_obj,write,return )


JProperties_obj::JProperties_obj()
{
}

void JProperties_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(JProperties);
	HX_MARK_END_CLASS();
}

void JProperties_obj::__Visit(HX_VISIT_PARAMS)
{
}

Dynamic JProperties_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 4:
		if (HX_FIELD_EQ(inName,"read") ) { return read_dyn(); }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"write") ) { return write_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic JProperties_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	return super::__SetField(inName,inValue,inCallProp);
}

void JProperties_obj::__GetFields(Array< ::String> &outFields)
{
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	HX_CSTRING("read"),
	HX_CSTRING("write"),
	String(null()) };

static ::String sMemberFields[] = {
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

static void sVisitStatics(HX_VISIT_PARAMS) {
};

Class JProperties_obj::__mClass;

void JProperties_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("JProperties"), hx::TCanCast< JProperties_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void JProperties_obj::__boot()
{
}

